<template>
  <div v-if="fileType !== 'mp4'" class="preview-container">
    <xn-file-preview
      :src="src"
      :file-type="fileType"
      @goBack="emit('goBack')"
    />
  </div>
  <div v-if="fileType === 'mp4' && src">
    <Video :url="src"></Video>
  </div>
</template>

<script setup name="filePreview">
import XnFilePreview from "../components/common/FilePreview.vue";
import Video from "../components/common/Video.vue";
const emit = defineEmits({ goBack: null });
const props = defineProps({
  src: {
    type: String,
    default: "",
    required: true,
  },
  // 文件类型
  fileType: {
    type: String,
    default: "defaults",
    required: false,
  },
});
</script>
<style scoped lang="less">
.preview-container {
  max-height: 800px;
}
</style>
